<?php

/*
 * @author: Colin Hom
 * @Description: Sidebar template for the message inbox, for use in sidebars in user profile, etc..
 * @Package: Finalsclub
 * @Subpackage: messages
 */
 ?>
 <div class="module messages">
	<h3 class="gradient dark with-message"><p class="message-number"><?php echo $unseen_count; /*the counter is for unread messages in inbox*/?></p>Message Center</h3>

	<div class="inner">
		<ul>
	<?php foreach($message_list->getResults() as $message): ?>	
			<li>
			<?php echo ($message->getSeen() == 0 ? "<b>" : "") /*Bolding for unread messages*/?> 
					<span class="date"><?php echo $message->getCreatedAt('%a %b %d, %Y') ?></span>
					<span class="username"><?php echo render_profile_link(UserPeer::retrieveByPK($message->getSenderId())) ?></span>
					<span class="message"><?php echo link_to($message->getSubject(), "messages/show?id=".$message->getId().'&group_id='.$message->getTypeId())?></span>
			<?php echo ($message->getSeen() == 0 ? "</b>" : "") ?>
			</li>
	<?php endforeach; ?>		
		</ul>
	</div>
</div>
 